$(function() {
	document.title = "t-io管理"
});

function s(form, showconfirm, requestpath) {
	this.success = function(form) {
		ajax.post(requestpath, {
			data: $(form).serialize(),
			success: function(resp) {
				if (resp.ok) {
					layer.msg('操作成功');
					// window.location.href = "/blog/r/index.html?id=" + resp.data.id;0
					//window.location.href = "/" + resp.data.id;   //用nginx的rewrite重写了一下路径: rewrite ^\/(\d+?)$ /blog/r/index.html?id=$1 last;
				} else {
					layer.alert(resp.msg);
				}
			}
		});
	};
	
	if (showconfirm) {
		var self = this;
		layer.confirm('确定执行该操作？', { icon: 3, title: '提示' }, function(index) {
			self.success(form);
		});
	} else {
		this.success(form);
	}
}
